import { _decorator, Component, director, Node, Toggle, tween, find, v3, Tween } from 'cc';
import { AudioManager } from './AudioManager';
import Banner from './Banner';
const { ccclass, property } = _decorator;

@ccclass('MainMenu')
export class MainMenu extends Component {

    @property(Node)
    PrivacyPanel: Node;

    start() {
        Banner.Instance.ShowBanner();
        tween(find("Canvas/StartBtn"))
            .to(0.5, { position: v3(0, find("Canvas/StartBtn").position.y + 20) })
            .to(0.5, { position: v3(0, find("Canvas/StartBtn").position.y) })
            .union()
            .repeatForever()
            .start();
    }

    update(deltaTime: number) {

    }


    OnStartBtnClicked(event: Event) {
        AudioManager.Instance.playSound("Audio/Button");
        director.loadScene("Loading");
    }

    OnHideBtnClicked() {
        AudioManager.Instance.playSound("Audio/Button");
        this.PrivacyPanel.active = true;
        this.PrivacyPanel.getChildByName("ScrollView").getChildByName("Toggle").getComponent(Toggle).isChecked = true;
    }
}


